﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PPI.Client.Interface;
using PPI.Client.Presenter;
using PPI.Entities.Enumerator;

namespace PPI
{
    public partial class frmAutolink : frmBase,IAutolink
    {
        private AutolinkPresenter m_presenter;
        private DatabaseTypes m_databaseType;
        private string m_Connectionstring;

        public frmAutolink()
        {
            InitializeComponent();
            MenuMain.Visible = false;
            m_presenter = new AutolinkPresenter(this);
        }

        public DatabaseTypes DatabaseType
        {
            get { return m_databaseType; }
            set { m_databaseType = value; }
        }

        public string Connectionstring
        {
            get { return m_Connectionstring; }
            set { m_Connectionstring = value; }
        }

        public double Distance
        {
            get { return txtMeters.Value; }
        }

        public void ChangeMarqueeBar()
        {
            progressBarX1.ProgressType = DevComponents.DotNetBar.eProgressItemType.Marquee;
        }

        public void ChangeDefaultBar()
        {
            progressBarX1.ProgressType = DevComponents.DotNetBar.eProgressItemType.Standard;
        }

        private void btnExecute_Click(object sender, EventArgs e)
        {
            m_presenter.Execute();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmAutolink_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = !m_presenter.IsReadytoClose;
        }

        private void frmAutolink_Load(object sender, EventArgs e)
        {
            txtMeters.Value = 10;
        }
    }
}
